<?php
/**
 * @package pmapi
 * @copyright Copyright (c)2014 Enrico Fagnoni
 * @license GNU General Public License version 3, or later
 *
 * @since 1.0.0
 */
 
defined('_JEXEC') or die;

if (!class_exists('PagedLinkedDataView')) require(JPATH_COMPONENT.DS.'views'.DS.'pagedlinkeddata.php');

class PmapiViewUsers extends PagedLinkedDataView
{
    protected $items=array(),$pagedURI='';
    
        
    protected function _computeETag()
    {
        return md5(serialize($this->items));
    }    
    
    
    public function GET_RequestProcessor($tpl = null) 
    {        
        $this->pagedURI = $this->getPagedURI();
        
        $this->items = $this->get('Items');
        // Check for errors.
        if (count($errors = $this->get('Errors')) || empty($this->items)) {
            throw new Exception(implode("\n", $errors)|| 'Not found', 404);
        }
               
        return parent::GET_RequestProcessor($tpl);
    }
}